package regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;

public class PatternTest {
	public static void main(String[] args) {
		Pattern pattern = Pattern.compile("R", Pattern.CASE_INSENSITIVE);
		Matcher matcher = pattern.matcher("RW");
		System.out.println(matcher.matches());
		System.out.println("==============================");
		System.out.println("cre;ate Ti'me--".replaceAll("([';])+|(--)+",""));
		System.out.println("==============================");
		
	}
	@Test
	public void test01(){
		String msg = "1 2 3 45 6 78";
		msg = StringUtils.deleteWhitespace(msg);
		System.out.println(msg);
		Pattern pattern = Pattern.compile("\\d{7,}", Pattern.CASE_INSENSITIVE);
		Matcher matcher = pattern.matcher(msg);
		System.out.println(matcher.matches());
		System.out.println(matcher.find(0));
	}

	@Test
	public void test02(){
		Pattern p=Pattern.compile("([^/]*)$");
		Matcher matcher = p.matcher("rtmp://ws.uprtmp.m.51vv.com/live/test-yunzb-1056514e19401e8bba4129ae75a87647b66e4b");
		if(matcher.find()){
			System.out.println(matcher.group(1));
		}
	}

}
